package com.sa.token.oauth2.demo.satokenoauth2demo.controller;

import cn.dev33.satoken.context.SaHolder;
import cn.dev33.satoken.oauth2.config.SaOAuth2Config;
import cn.dev33.satoken.oauth2.logic.SaOAuth2Handle;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Sa-OAuth2 Server端 控制器
 */
@RestController
public class UserController {
    @RequestMapping("/getUserInfo")
    public Object getUserInfo() {
        Object loginId = StpUtil.getLoginId();
        Object userInfo = StpUtil.getSessionByLoginId(loginId).get("userInfo");
        return "正常登录的"+userInfo;
    }
}

